#ifndef FHE_PYTHON_NODE_H
#define FHE_PYTHON_NODE_H

#include <fhe/core/Node.h>
#include <boost/python.hpp>

namespace fhe
{
  using namespace core;
  namespace python
  {
    class FHE_API PyNode
    {
    public:
      PyNode( const std::string& module, const std::string& type );
      PyNode( const Node::Ptr& node );
      virtual ~PyNode();
      
      static boost::python::object reg( const std::string& module );
      static void regClosure( boost::python::object obj );
      
      bool eq( PyNode* node ) const;

      std::string module() const;
      std::string type() const;
      PyNode* parent() const;
      boost::python::list children() const;
      bool hasChild( PyNode* child ) const;
      
      void attachToParent( PyNode* node );
      void detachFromParent();
      void addChild( PyNode* child );
      void removeChild( PyNode* child );
      
      boost::python::list funcs() const;
      boost::python::list vars() const;
      
      boost::python::object getAttr( const std::string& name ) const;
      void setAttr( const std::string& name, boost::python::object obj );
      
      void addFunc( boost::python::object func );
      
      static boost::python::object define();
      
    private:
      Node::Ptr node_;
      static std::string regModule_;
    };
  }
}

#endif
